<template>
    <div class="bg">
        <div class="login">
            <div class="login-logo">范希美</div>
            <van-cell-group>
                <van-field v-model="username" label="用户名" placeholder="请输入用户名" />
                <van-field v-model="password" type="password" label="密码" placeholder="请输入密码" />
            </van-cell-group>
            <van-button type="primary" block @click="toLogin()">登录</van-button>
        </div>

    </div>
</template>

<script>

export default {
    
    data(){
        return {
            username:"",
            password:"",
        }
    },
    mounted() {
        
    },
    methods: {
        // 登录按钮
        toLogin(){
            if(this.username == "1" && this.password == "1"){
                localStorage.setItem("token","fanximei")
                this.$router.push("/netIndex")
            }else{
                alert('账号或密码错误！')
            }
        },
    },
}
</script>

<style scoped lang="less">
.bg{
    font-family: "微软雅黑";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login{
    height: 40%;
    width: 80%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    .login-logo{
        font-size: 3rem;
        text-align: center;
    }
}
</style>